package com.myproxyDynamicJdk;

import java.lang.reflect.Proxy;

public class ZMainTest {

	/**
	 * JDK动态代理
	 * @param args
	 */
	public static void main(String[] args) {
		SingInterface singer = new Singer();
		HetongHandler hetong = new HetongHandler(singer);
		Class<?> zlass = singer.getClass();
		
		SingInterface proxy = (SingInterface) Proxy
				.newProxyInstance(zlass.getClassLoader(), zlass.getInterfaces(), hetong);
		proxy.sing();
		
	}
}
